package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Sort {
    private long sortId;
    private String sortName;
    private String sortIcon;
    private String sortRank;
    private List<Function> functionList;
    @OneToMany(mappedBy = "sortBySortId")
    public List<Function> getFunctionList() {
        return functionList;
    }

    public void setFunctionList(List<Function> functionList) {
        this.functionList = functionList;
    }

    @Id
    @Column(name = "SORT_ID", nullable = false, precision = 0)
    public long getSortId() {
        return sortId;
    }

    public void setSortId(long sortId) {
        this.sortId = sortId;
    }

    @Basic
    @Column(name = "SORT_NAME", nullable = true, length = 1024)
    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    @Basic
    @Column(name = "SORT_ICON", nullable = true, length = 1024)
    public String getSortIcon() {
        return sortIcon;
    }

    public void setSortIcon(String sortIcon) {
        this.sortIcon = sortIcon;
    }

    @Basic
    @Column(name = "SORT_RANK", nullable = true, length = 1024)
    public String getSortRank() {
        return sortRank;
    }

    public void setSortRank(String sortRank) {
        this.sortRank = sortRank;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Sort sort = (Sort) o;
        return sortId == sort.sortId &&
                Objects.equals(sortName, sort.sortName) &&
                Objects.equals(sortIcon, sort.sortIcon) &&
                Objects.equals(sortRank, sort.sortRank);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sortId, sortName, sortIcon, sortRank);
    }
}
